package com.chenqi.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.chenqi.model.entity.Post;
import com.chenqi.model.entity.PostTag;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @description: 帖子与标签数据层
 * @program: ardaicommunity
 * @author: ChenQi
 * @create: 2021-03-2021/3/12-16-18
 */
@Repository
public interface PostTagMapper extends BaseMapper<PostTag> {

    /**
     * 维护帖子与标签的关系
     * @param pid
     * @param tid
     * @return
     */
    int insertPostIdAndTagsId(@Param("pid") Integer pid, @Param("tid") Integer tid);

    /**
     * 通过帖子id查询对应的标签id
     * @param pid
     * @return
     */
    List<Integer> findTagsByPostId(Integer pid);


}
